package com.techstar.mqttprocesser.service.mqtt.handler.device;

import com.techstar.mqttprocesser.service.mqtt.model.DeviceType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author lilei
 * @create 2025-03-27-2025/3/27
 */
@Component
public class DeviceDataParseFactory {

    @Autowired
    private List<DeviceDataParse> deviceDataParseList;

    public DeviceDataParse getMessageHandler(DeviceType deviceType) {
        //解析出来时秒级时间戳，需要转换为毫秒级
        for (DeviceDataParse deviceDataParse : deviceDataParseList) {
            if (deviceDataParse.getDeviceType() == deviceType) {
                return deviceDataParse;
            }
        }
        return null;
    }

}
